/*
 * @(#)ConnectorInfo.java $version 2010. 8. 11
 *
 * Copyright 2007-2010 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nhncorp.usf.core.config;

import java.util.Properties;

/**
 * 특정 Invoker가 연결을 시도하게 될 Peer에 대한 속성
 *
 * @author Web Platform Development Team
 */
public class ConnectorInfo {
    private String id;
    private String invoker;
    private String address;

    /**
     * Invoker 생성을 위한 속성 정보를 담은 {@link Properties}.
     */
    private Properties properties = new Properties();

    /**
     * Instantiates a new connector info.
     *
     * @param id      the id
     * @param invoker the invoker
     * @param address the address
     */
    @Deprecated
    public ConnectorInfo(String id, String invoker, String address) {
        this.id = id;
        this.invoker = invoker;
        this.address = address;
    }

    /**
     * Instantiates a new connector info.
     *
     * @param id      the id
     * @param address the address
     */
    public ConnectorInfo(String id, String address) {
        this.id = id;
        this.address = address;
    }

    /**
     * Invoker 생성을 위한 속성 정보 추가.
     *
     * @param key   the property key
     * @param value the property value
     */
    public void addProperty(String key, String value) {
        properties.setProperty(key, value);
    }

    /**
     * Invoker 생성을 위한 {@link Properties} 반환.
     *
     * @return the properties
     */
    public Properties getProperties() {
        return this.properties;
    }

    /**
     * Invoker 생성을 위한 속성 정보 반환.
     *
     * @param name the property key name
     * @return the property value for key name
     */
    public String getPropertyValue(String name) {
        return properties.getProperty(name);
    }

    /**
     * Gets the id.
     *
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * Gets the invoker.
     *
     * @return the invoker
     */
    public String getInvoker() {
        return invoker;
    }

    /**
     * Gets the address.
     *
     * @return the address
     */
    public String getAddress() {
        return address;
    }
}
